package com.boot.security.server.dao.mffl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.mffl.MfflBankcard;

@Mapper
public interface MfflBankcardDao {

    @Select("select * from mffl_bankcard t where t.id = #{id}")
    MfflBankcard getById(Long id);

    @Delete("delete from mffl_bankcard where id = #{id}")
    int delete(Long id);

    int update(MfflBankcard mfflBankcard);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into mffl_bankcard(bankcardnumber, bank, userid, createTime, updateTime, deleteTime, deletestate,realname) values(#{bankcardnumber}, #{bank}, #{userid}, #{createTime}, #{updateTime}, #{deleteTime}, #{deletestate},#{realname})")
    int save(MfflBankcard mfflBankcard);
    
    int count(@Param("params") Map<String, Object> params);

    List<MfflBankcard> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);

    //获取用户银行卡信息
    @Select("select * from mffl_bankcard t where t.userid = #{userid}")
    MfflBankcard getByUserId(@Param("userid") Integer userid);
}
